Groups in parallel the elements of a sequence according to a specified key selector function and
projects the elements for each group by using a specified function.
Namespace:
System.Linq
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Shared Function GroupBy(Of TSource, TKey, TElement) ( _
source As ParallelQuery(Of TSource), _
keySelector As Func(Of TSource, TKey), _
elementSelector As Func(Of TSource, TElement) _
) As ParallelQuery(Of IGrouping(Of TKey, TElement)) |
C# |
---|
public static ParallelQuery<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(
ParallelQuery<TSource> source,
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector
)
|
Parameters
- source
- Type: System.Linq..::.ParallelQuery<(Of <(TSource>)>)
An OrderedParallelQuery<(Of <(TElement>)>) than contains
elements to sort.
- keySelector
- Type: System..::.Func<(Of <(TSource, TKey>)>)
A function to extract a key from an element.
- elementSelector
- Type: System..::.Func<(Of <(TSource, TElement>)>)
A function to map each source element to an element in an IGrouping.
Type Parameters
- TSource
- The type of elements of source.
- TKey
- The type of the key returned by keySelector.
- TElement
- The type of the elements in the IGrouping
Return Value
A ParallelQuery<IGrouping<TKey, TElement>> in C# or
ParallelQuery(Of IGrouping(Of TKey, TElement)) in Visual Basic where each IGrouping
generic object contains a collection of objects of type
TElement and a key.
Exceptions
Exception | Condition |
---|
System..::.ArgumentNullException |
source or keySelector or
elementSelector is a null reference (Nothing in Visual Basic).
|
See Also